import { createApp } from 'vue'
import App from './App.vue'
// reset style sheet
import '@/styles/reset.scss'
// CSS common style sheet
import '@/styles/common.scss'
// iconfont css
import '@/assets/iconfont/iconfont.scss'
// font css
import '@/assets/fonts/font.scss'
// element css
import 'element-plus/dist/index.css'
// element dark css
import 'element-plus/theme-chalk/dark/css-vars.css'
// custom element dark css
import '@/styles/element-dark.scss'
// custom element css
import '@/styles/element.scss'
// svg icons
import 'virtual:svg-icons-register'
// svg图标
import ElementIcons from '@/plugins/svg-icon'
// element plus
import ElementPlus from 'element-plus'
// custom directives
import directives from '@/directives/index'
// vue Router
import router from '@/routers'
// vue i18n
import I18n from '@/languages/index'
// pinia store
import pinia from '@/stores'
// errorHandler
import errorHandler from '@/utils/errorHandler'

import { useDict } from '@/utils/dict'
const app = createApp(App)

// 全局方法挂载
app.config.globalProperties.useDict = useDict

// 全局组件挂载
// app.component('DictTag', DictTag)
app.config.errorHandler = errorHandler

// register the element Icons component
// Object.keys(Icons).forEach(key => {
//   app.component(key, Icons[key as keyof typeof Icons])
// })

app.use(ElementPlus).use(ElementIcons).use(directives).use(router).use(I18n).use(pinia).mount('#app')
